package com.x.service.entity.map;

import com.x.service.entity.BookList;
import com.x.service.entity.BookListsBean;
import com.x.zssqservice.bean.BooksByTag;

import java.util.ArrayList;

/**
 * Created by H on 18/5/9.
 */

public class BooksByTagToBookList implements IMap<BooksByTag, BookList> {
    @Override
    public BookList map(BooksByTag booksByTag) {
        BookList bookList = new BookList();
        bookList.books = new ArrayList<>();
        bookList.ok = booksByTag.ok;
        for (BooksByTag.TagBook tagBook : booksByTag.books) {
            BookListsBean bookListsBean = new BookListsBean();
            bookListsBean._id = tagBook._id;
            bookListsBean.title = tagBook.title;
            bookListsBean.author = tagBook.author;
            bookListsBean.cover = IMG_BASE_URL + tagBook.cover;
            bookListsBean.shortIntro = tagBook.shortIntro;
            bookListsBean.lastChapter = tagBook.lastChapter;
            bookListsBean.latelyFollower = tagBook.latelyFollower;
            bookListsBean.majorCate = tagBook.majorCate;
            bookListsBean.minorCate = tagBook.minorCate;

            bookListsBean.updated = tagBook.updated;
//            bookListsBean.isSerial = tagBook.;
            bookList.books.add(bookListsBean);
        }
        return bookList;
    }
}
